import request from '../../../utils/request'
import type { responseCategory } from './model/index'

enum API {
    GETC1 = "/admin/product/getCategory1", // 获取c1 GET 
    GETC2 = "/admin/product/getCategory2/",//获取c2 GET 
    GETC3 = "/admin/product/getCategory3/",//获取c3 GET 
    ATTRINFO = "/admin/product/attrInfoList/",//获取平台属性 GET 
    //添加一个新的属性与修改一个已有属性的接口地址
    addOrUpdateAttr = "/admin/product/saveAttrInfo",
    //删除
    DELETEATTR = "/admin/product/deleteAttr/",
}

//获取商品分类c1
export const reqC1 = () => request.get<any, responseCategory>(API.GETC1)

export const reqC2 = (category1Id: string | number) => request.get<any, responseCategory>(API.GETC2 + category1Id)

export const reqC3 = (category1Id: string | number) => request.get<any, responseCategory>(API.GETC3 + category1Id)

//获取平台属性
export const attrInfo = (category1Id: any, category2Id: any, category3Id: any) => request.get(API.ATTRINFO + `${category1Id}/${category2Id}/${category3Id}`)

//添加或者修改属性的接口函数
export const reqAddOrUpdateAttr = (data:any)=>request.post(API.addOrUpdateAttr,data);

//删除
export const deleteAttr = (attrId:number) => request.delete(API.DELETEATTR + `${attrId}`)